package com.example.spareparts.repository;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.*;
import java.util.List;
import com.example.spareparts.entity.InventoryAlerts;


@Mapper
public interface InventoryAlertsRepository {
    @Select("SELECT * FROM InventoryAlerts")
    List<InventoryAlerts> findAllInventoryAlerts();
    @Insert("INSERT INTO InventoryAlerts (spare_part_id, total_quantity, status) VALUES (#{sparepartid}, #{totalQuantity}, #{status})")
    @Options(useGeneratedKeys = true, keyProperty = "alertid")
    void insertInventoryAlerts(InventoryAlerts inventoryAlerts);
    @Update("UPDATE InventoryAlerts SET alert_id= #{alertid}, spare_part_id= #{sparepartid}, total_quantity= #{totalQuantity}, status= #{status} WHERE alert_id= #{alertid}")
    void updateInventoryAlerts(InventoryAlerts inventoryAlerts);
    @Delete("DELETE FROM InventoryAlerts WHERE alert_id= #{alertid}")
    void deleteInventoryAlerts(Long alertid);
    @Select("SELECT * FROM InventoryAlerts WHERE alert_id= #{alertid}")
    InventoryAlerts findInventoryAlertsById(Long alertid);
    @Select("SELECT * FROM InventoryAlerts WHERE spare_part_id= #{sparepartid}")
    List<InventoryAlerts> findInventoryAlertsBySparePartId(Long sparepartid);
}
